package gui_classes;


import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

import java.util.Iterator;
import java.util.List;

import domain.*;
import java_persistence.*;

/*
 * This class represents a Patients home page
 */

public class PatientsPagePanel extends JPanel {

	private JLabel lblEditpharm;
	private JLabel lblEditinsur;
	private JLabel lblEditaller;
	private JLabel lblEditgender;
	private JLabel lblEditbdate;
	
	private Patient currPatient;
	
	/**
	 * Create the panel.
	 */
	public PatientsPagePanel(Patient pat) {
		setPreferredSize(new Dimension(300, 300));
		setLayout(null);
		
		GUI_Main.getFrame().setTitle("Logged in as " +pat.getName());
		
		
		setAttr(pat);
		
		JLabel lblPharmacy = new JLabel("Pharmacy:");
		lblPharmacy.setBounds(12, 12, 98, 15);
		add(lblPharmacy);
		
		JLabel lblInsuranceInfo = new JLabel("Insurance Info:");
		lblInsuranceInfo.setBounds(12, 73, 128, 15);
		add(lblInsuranceInfo);
		
		JLabel lblAllergies = new JLabel("Allergies:");
		lblAllergies.setBounds(12, 146, 70, 15);
		add(lblAllergies);
		
		JLabel lblGender = new JLabel("Gender:");
		lblGender.setBounds(12, 209, 70, 15);
		add(lblGender);
		
		JLabel lblBirthdate = new JLabel("Birthdate:");
		lblBirthdate.setBounds(12, 260, 84, 15);
		add(lblBirthdate);
			

	}
	
	/*
	 * sets all the attributes on the labels
	 * @param pat Patient whose attributes you want to view
	 */
	public void setAttr(Patient pat)
	{
	
		System.out.println(pat.getPharmacy());
		System.out.println(pat.getInsurance_info());
		System.out.println(pat.getAllergies());
		System.out.println(pat.getBirthdate());
	//	pat.getIs_male(); //bool
				
		
		this.lblEditpharm = new JLabel(pat.getPharmacy());
		lblEditpharm.setBounds(68, 39, 220, 15);
		add(lblEditpharm);
		
		this.lblEditinsur = new JLabel(pat.getInsurance_info());
		lblEditinsur.setBounds(68, 100, 220, 15);
		add(lblEditinsur);
		
		this.lblEditaller = new JLabel(pat.getAllergies());
		lblEditaller.setBounds(57, 174, 231, 15);
		add(lblEditaller);
		
		this.lblEditbdate = new JLabel(pat.getBirthdate());
		lblEditbdate.setBounds(94, 273, 168, 15);
		add(lblEditbdate);
		
		if(pat.getIs_male()){
			this.lblEditgender = new JLabel("Male");
			lblEditgender.setBounds(68, 236, 70, 15);
			add(lblEditgender);
		}
		else
		{
			this.lblEditgender = new JLabel("Female");
			lblEditgender.setBounds(68, 236, 70, 15);
			add(lblEditgender);
		}
		
	}
}
